package com.station.search.domain.converter;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

/**
 * @author: JT
 * @date: 2021/11/5
 * @Title:
 */
@Mapper
public interface StationDescConverter {

    StationDescConverter INSTANCE = Mappers.getMapper(StationDescConverter.class);


    default List<Object> objToListOfDto(Object obj) {
        if (Objects.isNull(obj)) {
            return Arrays.asList("暂无数据");
        }
        if (Collection.class.isAssignableFrom(obj.getClass())) {
            return (List<Object>) obj;
        }
        return Arrays.asList(obj);
    }
}
